; Exercise 1.11:
; A function f is defined by the rule that
;
;         / n                            if n <  3
; f(n) = <
;         \ f(n-1) + 2f(n-2) + 3f(n-3)   if n >= 3
;
; Write a procedure that computes f by means of an iterative process.

(define (function n)
  (function-iter 2 1 0 n))

(define (function-iter a b c count)
  (if (= count 0)
    c
    (function-iter (+ a (* 2 b) (* 3 c)) a b (- count 1))))

